
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>章节一:flask框架入门 · 组团学</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="李航老师">
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-code/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-back-to-top-button/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search-pro/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-flexible-alerts/style.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-theme-lou/lou.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="chapter2.html" />
    
    

    </head>
    <body>
         

<div class="book">
  <div class="header-inner">
    <!-- LOGO -->
    <div class="logo"></div>
    <span class="title"></span>

    <!-- Search -->
    
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>


    <!-- Nav -->
    <ul class="header-nav">
      <li>
        <a href="https://space.bilibili.com/378936143" target="_blank">B站</a>
      </li><li>
        <a href="https://mp.weixin.qq.com/mp/profile_ext?action=home&__biz=MzIzMjY0NjU5Ng==&scene=124#wechat_redirect" target="_blank">公众号</a>
      </li><li>
        <a href="https://edu.csdn.net/course/detail/32032" target="_blank">CSDN</a>
      </li>
    </ul>
  </div>

  <div class="book-summary">
    <div class="book-summary-title">文档目录</div>
     
    <nav role="navigation">


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" >
            
                <span>
            
                    
                    c语言程序设计
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../c/chapter1.html">
            
                <a href="../c/chapter1.html">
            
                    
                    章节一:初识C语言程序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../c/chapter2.html">
            
                <a href="../c/chapter2.html">
            
                    
                    章节二:常用数据类型(整数)
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../c/chapter3.html">
            
                <a href="../c/chapter3.html">
            
                    
                    章节三:常用数据类型(浮点型)
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="../c/chapter4.html">
            
                <a href="../c/chapter4.html">
            
                    
                    章节四:数据类型转换
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="../c/chapter5.html">
            
                <a href="../c/chapter5.html">
            
                    
                    章节五:运算符
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="../c/chapter6.html">
            
                <a href="../c/chapter6.html">
            
                    
                    章节六:选择结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.7" data-path="../c/chapter7.html">
            
                <a href="../c/chapter7.html">
            
                    
                    章节七:switch
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.8" data-path="../c/chapter8.html">
            
                <a href="../c/chapter8.html">
            
                    
                    章节八:for循环
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.9" data-path="../c/chapter9.html">
            
                <a href="../c/chapter9.html">
            
                    
                    章节九:嵌套for循环
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.10" data-path="../c/chapter10.html">
            
                <a href="../c/chapter10.html">
            
                    
                    章节十:强化练习
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.11" data-path="../c/chapter11.html">
            
                <a href="../c/chapter11.html">
            
                    
                    章节十一:数组
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.12" data-path="../c/chapter12.html">
            
                <a href="../c/chapter12.html">
            
                    
                    章节十二:数组函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.13" data-path="../c/chapter13.html">
            
                <a href="../c/chapter13.html">
            
                    
                    章节十三:函数
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" >
            
                <span>
            
                    
                    html基础
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../html/Html基础标签1.html">
            
                <a href="../html/Html基础标签1.html">
            
                    
                    章节一:Html基础标签1
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../html/Html基础标签2.html">
            
                <a href="../html/Html基础标签2.html">
            
                    
                    章节二:Html基础标签2
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" >
            
                <span>
            
                    
                    Flask Web开发
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter active" data-level="1.4.1" data-path="chapter1.html">
            
                <a href="chapter1.html">
            
                    
                    章节一:flask框架入门
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="chapter2.html">
            
                <a href="chapter2.html">
            
                    
                    章节二:模版渲染
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="chapter3.html">
            
                <a href="chapter3.html">
            
                    
                    章节三:html基本标签
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="chapter4.html">
            
                <a href="chapter4.html">
            
                    
                    章节四:项目拆分
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="chapter5.html">
            
                <a href="chapter5.html">
            
                    
                    章节五:路由参数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.6" data-path="chapter6.html">
            
                <a href="chapter6.html">
            
                    
                    章节六:请求与响应
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.7" data-path="chapter7.html">
            
                <a href="chapter7.html">
            
                    
                    章节七:flask-Cookie
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.8" data-path="chapter8.html">
            
                <a href="chapter8.html">
            
                    
                    章节八:模型数据
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.9" data-path="chapter9.html">
            
                <a href="chapter9.html">
            
                    
                    章节九:单表-增删查改一
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.10" data-path="chapter10.html">
            
                <a href="chapter10.html">
            
                    
                    章节十:单表-增删查改二
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.11" data-path="chapter11.html">
            
                <a href="chapter11.html">
            
                    
                    章节十一:图书管理系统
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" >
            
                <span>
            
                    
                    gitbook文档搭建
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../book/chapter1.html">
            
                <a href="../book/chapter1.html">
            
                    
                    章节一:环境安装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../book/chapter2.html">
            
                <a href="../book/chapter2.html">
            
                    
                    章节二:typora使用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="../book/chapter3.html">
            
                <a href="../book/chapter3.html">
            
                    
                    章节三:电子书搭建
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="../book/chapter4.html">
            
                <a href="../book/chapter4.html">
            
                    
                    章节四:插件安装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="../book/chapter5.html">
            
                <a href="../book/chapter5.html">
            
                    
                    章节五:部署
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>

</nav>
     
  </div>

  <!-- Content nav -->
  <div class="book-anchor">
    <div class="book-anchor-title"></div>

    <div class="book-anchor-body"></div>
  </div>

  <div class="book-body">
    
    <div class="body-inner">
       

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >章节一:flask框架入门</a>
    </h1>
</div>



      <div class="page-wrapper" tabindex="-1" role="main">
        <div class="page-inner">
          
<div id="book-search-results">
    <div class="search-noresults">
    
          <section class="normal markdown-section">
             <h2 id="&#x5B66;&#x4E60;&#x76EE;&#x6807;">&#x5B66;&#x4E60;&#x76EE;&#x6807;</h2>
<ul>
<li>&#x4E86;&#x89E3;flask&#x6846;&#x67B6;</li>
<li>&#x638C;&#x63E1;flask&#x6846;&#x67B6;&#x642D;&#x5EFA;</li>
<li>&#x638C;&#x63E1;flask&#x6846;&#x67B6;&#x5B89;&#x88C5;</li>
</ul>
<h2 id="&#x4ECB;&#x7ECD;">&#x4ECB;&#x7ECD;</h2>
<p>Flask&#x662F;&#x4E00;&#x4E2A;&#x8F7B;&#x91CF;&#x7EA7;&#x7684;&#x53EF;&#x5B9A;&#x5236;&#x6846;&#x67B6;&#xFF0C;&#x4F7F;&#x7528;Python&#x8BED;&#x8A00;&#x7F16;&#x5199;&#xFF0C;&#x8F83;&#x5176;&#x4ED6;&#x540C;&#x7C7B;&#x578B;&#x6846;&#x67B6;&#x66F4;&#x4E3A;&#x7075;&#x6D3B;&#x3001;&#x8F7B;&#x4FBF;&#x3001;&#x5B89;&#x5168;&#x4E14;&#x5BB9;&#x6613;&#x4E0A;&#x624B;&#x3002;&#x5B83;&#x53EF;&#x4EE5;&#x5F88;&#x597D;&#x5730;&#x7ED3;&#x5408;<a href="https://baike.baidu.com/item/MVC&#x6A21;&#x5F0F;/713147?fromModule=lemma_inlink" target="_blank">MVC&#x6A21;&#x5F0F;</a>&#x8FDB;&#x884C;&#x5F00;&#x53D1;&#xFF0C;&#x5F00;&#x53D1;&#x4EBA;&#x5458;&#x5206;&#x5DE5;&#x5408;&#x4F5C;&#xFF0C;&#x5C0F;&#x578B;&#x56E2;&#x961F;&#x5728;&#x77ED;&#x65F6;&#x95F4;&#x5185;&#x5C31;&#x53EF;&#x4EE5;&#x5B8C;&#x6210;&#x529F;&#x80FD;&#x4E30;&#x5BCC;&#x7684;&#x4E2D;&#x5C0F;&#x578B;&#x7F51;&#x7AD9;&#x6216;<a href="https://baike.baidu.com/item/Web&#x670D;&#x52A1;/2837593?fromModule=lemma_inlink" target="_blank">Web&#x670D;&#x52A1;</a>&#x7684;&#x5B9E;&#x73B0;&#x3002;&#x53E6;&#x5916;&#xFF0C;Flask&#x8FD8;&#x6709;&#x5F88;&#x5F3A;&#x7684;&#x5B9A;&#x5236;&#x6027;&#xFF0C;&#x7528;&#x6237;&#x53EF;&#x4EE5;&#x6839;&#x636E;&#x81EA;&#x5DF1;&#x7684;&#x9700;&#x6C42;&#x6765;&#x6DFB;&#x52A0;&#x76F8;&#x5E94;&#x7684;&#x529F;&#x80FD;&#xFF0C;&#x5728;&#x4FDD;&#x6301;&#x6838;&#x5FC3;&#x529F;&#x80FD;&#x7B80;&#x5355;&#x7684;&#x540C;&#x65F6;&#x5B9E;&#x73B0;&#x529F;&#x80FD;&#x7684;&#x4E30;&#x5BCC;&#x4E0E;&#x6269;&#x5C55;&#xFF0C;&#x5176;&#x5F3A;&#x5927;&#x7684;&#x63D2;&#x4EF6;&#x5E93;&#x53EF;&#x4EE5;&#x8BA9;&#x7528;&#x6237;&#x5B9E;&#x73B0;&#x4E2A;&#x6027;&#x5316;&#x7684;&#x7F51;&#x7AD9;&#x5B9A;&#x5236;&#xFF0C;&#x5F00;&#x53D1;&#x51FA;&#x529F;&#x80FD;&#x5F3A;&#x5927;&#x7684;&#x7F51;&#x7AD9;&#x3002;</p>
<p>Flask&#x7684;&#x57FA;&#x672C;&#x6A21;&#x5F0F;&#x4E3A;&#x5728;&#x7A0B;&#x5E8F;&#x91CC;&#x5C06;&#x4E00;&#x4E2A;&#x89C6;&#x56FE;&#x51FD;&#x6570;&#x5206;&#x914D;&#x7ED9;&#x4E00;&#x4E2A;URL&#xFF0C;&#x6BCF;&#x5F53;&#x7528;&#x6237;&#x8BBF;&#x95EE;&#x8FD9;&#x4E2A;URL&#x65F6;&#xFF0C;&#x7CFB;&#x7EDF;&#x5C31;&#x4F1A;&#x6267;&#x884C;&#x7ED9;&#x8BE5;URL&#x5206;&#x914D;&#x597D;&#x7684;&#x89C6;&#x56FE;&#x51FD;&#x6570;&#xFF0C;&#x83B7;&#x53D6;&#x51FD;&#x6570;&#x7684;&#x8FD4;&#x56DE;&#x503C;&#x5E76;&#x5C06;&#x5176;&#x663E;&#x793A;&#x5230;&#x6D4F;&#x89C8;&#x5668;&#x4E0A;&#xFF0C;&#x5176;&#x5DE5;&#x4F5C;&#x8FC7;&#x7A0B;&#x89C1;&#x56FE;&#x3002;</p>
<p><img src="assets/image-20231111120611000.png" alt="image-20231111120611000"></p>
<p><strong>flask&#x6846;&#x67B6;&#x6A21;&#x5F0F;</strong></p>
<p>M&#xFF08;Models&#xFF09; &#x2014;&#x2014; &#x6A21;&#x578B;&#x5C42;&#xFF1A;&#x8D1F;&#x8D23;&#x6570;&#x636E;&#x5E93;&#x7684;&#x5EFA;&#x6A21;&#x3002;</p>
<p>T&#xFF08;Templates&#xFF09; &#x2014;&#x2014; &#x6A21;&#x677F;&#x5C42;&#xFF1A;&#x7528;&#x4E8E;&#x5904;&#x7406;&#x7528;&#x6237;&#x663E;&#x793A;&#x7684;&#x5185;&#x5BB9;&#x3002;&#x5982;&#xFF1A;html</p>
<p>V &#xFF08;Views&#xFF09;&#x2014;&#x2014; &#x89C6;&#x56FE;&#x5C42;&#xFF1A;&#x5904;&#x7406;&#x4E0E;&#x7528;&#x6237;&#x4EA4;&#x4E92;&#x7684;&#x90E8;&#x5206;&#x5185;&#x5BB9;&#x3002;&#x5982;&#xFF1A;&#x5904;&#x7406;&#x7528;&#x6237;&#x7684;&#x8BF7;&#x6C42;&#x5E76;&#x7ED9;&#x51FA;&#x54CD;&#x5E94;</p>
<h2 id="flask&#x6846;&#x67B6;&#x5B89;&#x88C5;">flask&#x6846;&#x67B6;&#x5B89;&#x88C5;</h2>
<pre><code class="lang-nginx">-- &#x5B89;&#x88C5;
pip install flask

-- &#x5378;&#x8F7D;
pip uninstall flask
</code></pre>
<p>&#x67E5;&#x770B;&#x5B89;&#x88C5;&#x6A21;&#x677F;</p>
<pre><code class="lang-nginx"><span class="hljs-attribute">pip</span> list
</code></pre>
<p>&#x6E90;</p>
<pre><code class="lang-nginx"> pip&#x4F7F;&#x7528;&#x56FD;&#x5185;pypi&#x955C;&#x50CF;
&#x3000;&#x3000;pip&#x547D;&#x4EE4;&#x9ED8;&#x8BA4;&#x4F7F;&#x7528;&#x7684;&#x662F;&#x56FD;&#x5916;&#x7684;pypi&#x955C;&#x50CF;&#xFF08;pypi.python.org)&#xFF0C;&#x5B89;&#x88C5;&#x6162;&#x4E0D;&#x8BF4;&#xFF0C;&#x6709;&#x65F6;&#x751A;&#x81F3;&#x4F1A;&#x5BFC;&#x81F4;&#x51FA;&#x73B0;&#x8D85;&#x65F6;&#x7B49;&#x7F51;&#x7EDC;&#x95EE;&#x9898;&#xFF0C;&#x9020;&#x6210;&#x5B89;&#x88C5;&#x5931;&#x8D25;&#x3002;&#x6240;&#x4EE5;&#xFF0C;&#x4F7F;&#x7528;&#x56FD;&#x5185;&#x7684;pypi&#x955C;&#x50CF;&#xFF0C;&#x4E0D;&#x5931;&#x4E3A;&#x4E00;&#x79CD;&#x52A0;&#x901F;pip&#x5B89;&#x88C5;&#x7B2C;&#x4E09;&#x65B9;&#x5305;&#x7684;&#x597D;&#x65B9;&#x6CD5;&#x3002;&#x56FD;&#x5185;&#x7684;&#x7B2C;&#x4E09;&#x65B9;&#x955C;&#x50CF;&#x6E90;&#x6709;&#x5F88;&#x591A;&#xFF0C;&#x5982;&#x4E0B;&#x6240;&#x793A;&#xFF1A;

&#x3000;&#x3000;&#x963F;&#x91CC;&#x4E91;&#x955C;&#x50CF;&#x6E90;&#xFF1A;http://mirrors.aliyun.com/pypi/simple/
&#x3000;&#x3000;&#x4E2D;&#x56FD;&#x79D1;&#x6280;&#x5927;&#x5B66;&#x955C;&#x50CF;&#x6E90;&#xFF1A; https://pypi.mirrors.ustc.edu.cn/simple/ 
&#x3000;&#x3000;&#x8C46;&#x74E3;&#x955C;&#x50CF;&#x6E90;&#xFF1A; http://pypi.douban.com/simple/ 
&#x3000;&#x3000;&#x6E05;&#x534E;&#x5927;&#x5B66;&#x955C;&#x50CF;&#x6E90;&#xFF1A;https://pypi.tuna.tsinghua.edu.cn/simple/
&#x3000;&#x3000;&#x4E2D;&#x56FD;&#x79D1;&#x5B66;&#x6280;&#x672F;&#x5927;&#x5B66;&#x955C;&#x50CF;&#x6E90;&#xFF1A;http://pypi.mirrors.ustc.edu.cn/simple/
&#x3000;&#x3000;&#x5982;&#x679C;&#x8981;&#x4F7F;&#x7528;&#x7B2C;&#x4E09;&#x65B9;&#x955C;&#x50CF;&#x6E90;&#xFF0C;&#x53EA;&#x9700;&#x8981;&#x5728;&#x5B89;&#x88C5;&#x65F6;&#xFF0C;&#x901A;&#x8FC7;pip&#x547D;&#x4EE4;&#x7684;-i&#x9009;&#x9879;&#x6307;&#x5B9A;&#x955C;&#x50CF;&#x6E90;&#x5373;&#x53EF;&#xFF0C;&#x4F8B;&#x5982;&#x901A;&#x8FC7;&#x8C46;&#x74E3;&#x6E90;&#x5B89;&#x88C5;flask&#xFF1A;
&#x3000;&#x3000;pip install -i https://pypi.douban.com/simple/ flask==0.12
</code></pre>
<h2 id="&#x642D;&#x5EFA;">&#x642D;&#x5EFA;</h2>
<p>&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x73ED;&#x7EA7;&#x6587;&#x4EF6;&#x5939;&#x667A;&#x80FD;2103&#x73ED;&#x3001;&#x5728;&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x7B2C;&#x4E00;&#x7AE0;-flask&#x5165;&#x95E8;&#x6587;&#x4EF6;&#x5939;&#x3001;&#x5728;&#x521B;&#x5EFA;&#x4E00;&#x4E2A;app.py&#x6587;&#x4EF6;</p>
<p><img src="assets/image-20231111121537998.png" alt="image-20231111121537998"></p>
<p>app.py&#x5185;&#x5BB9;&#x5982;&#x4E0B;</p>
<pre><code class="lang-py"><span class="hljs-comment">#1.&#x5BFC;&#x5165;flask&#x6A21;&#x5757;</span>
<span class="hljs-keyword">from</span> flask <span class="hljs-keyword">import</span> Flask
<span class="hljs-comment">#2.&#x521B;&#x5EFA;&#x4E00;&#x4E2A;Flask&#x5BF9;&#x8C61;</span>
app=Flask(__name__)

<span class="hljs-comment">#3.&#x51FD;&#x6570;+&#x8DEF;&#x7531; </span>
<span class="hljs-meta">@app.route(&apos;/&apos;)</span>
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">index</span><span class="hljs-params">()</span>:</span>
    <span class="hljs-keyword">return</span> <span class="hljs-string">&apos;index......&apos;</span>

<span class="hljs-comment">#4.&#x7A0B;&#x5E8F;&#x7684;&#x5165;&#x53E3;  main</span>
<span class="hljs-keyword">if</span> __name__ == <span class="hljs-string">&apos;__main__&apos;</span>:
    app.run(host=<span class="hljs-string">&apos;0.0.0.0&apos;</span>,port=<span class="hljs-number">5001</span>,debug=<span class="hljs-keyword">True</span>)
</code></pre>
<p>host:&#x4E3B;&#x673A;</p>
<p>port:&#x7AEF;&#x53E3;&#x53F7;</p>
<p>debug&#xFF1A;&#x662F;&#x5426;&#x5F00;&#x542F;debug&#x6A21;&#x5F0F;</p>
<p>&#x4EE5;&#x4E0A;&#x4E09;&#x4E2A;&#x53C2;&#x6570;&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#x53EF;&#x4EE5;&#x4E0D;&#x7528;&#x5199;</p>
<p>&#x542F;&#x52A8;&#x8BBF;&#x95EE;:localhost:5001/  &#x7ED3;&#x679C;&#x663E;&#x793A;index</p>
<h2 id="&#x7EC3;&#x4E60;">&#x7EC3;&#x4E60;</h2>
<p>&#x7EC3;&#x4E60;1-&#x8BBF;&#x95EE;&#x8DEF;&#x5F84;/h1&#xFF0C;&#x663E;&#x793A;:h1</p>
<pre><code class="lang-py"><span class="hljs-meta">@app.route(&apos;/h1&apos;)</span>
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">h1</span><span class="hljs-params">()</span>:</span>
    <span class="hljs-keyword">return</span> <span class="hljs-string">&apos;h1&apos;</span>
</code></pre>
<p>&#x7EC3;&#x4E60;2-&#x8BBF;&#x95EE;&#x8DEF;&#x5F84;/h2,&#x663E;&#x793A;:h2</p>
<pre><code class="lang-py"><span class="hljs-meta">@app.route(&apos;/h2&apos;)</span>
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">h2</span><span class="hljs-params">()</span>:</span>
    <span class="hljs-keyword">return</span> <span class="hljs-string">&apos;h2&apos;</span>
</code></pre>
<p>&#x7EC3;&#x4E60;3-&#x8BBF;&#x95EE;&#x8DEF;&#x5F84;/login,&#x663E;&#x793A;:&#x767B;&#x5F55;</p>
<pre><code class="lang-py"><span class="hljs-meta">@app.route(&apos;/login&apos;)</span>
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">login</span><span class="hljs-params">()</span>:</span>
    <span class="hljs-keyword">return</span> <span class="hljs-string">&apos;&#x767B;&#x5F55;...&apos;</span>
</code></pre>
 
          </section>
          
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>
 
        </div>
      </div>
      
    </div>

      
    <a
      href="chapter2.html"
      class="navigation navigation-next navigation-unique"
      aria-label="Next page: 章节二:模版渲染"
    >
      <i class="fa fa-angle-right"></i>
    </a>
      
  </div>
  <script>
    function showModal() {
      document.getElementsByClassName("mask")[0].style.display = "block";
      document.getElementsByClassName("donate-modal")[0].style.display =
        "block";
    }
    // 切换赞赏码
    function showDonateImg(num) {
      let alipay = "";
      let wxpay = ""
      if(num){
        wxpay = "hidden"
      }else{
        alipay = "hidden"
      }
      document.getElementById("wxpay-code").hidden = wxpay;
      document.getElementById("alipay-code").hidden = alipay;
      document.getElementsByName("pay-way")[num].checked = "checked";
    }

    // 关闭赞赏框
    function closeDonateModal() {
      document.getElementsByClassName("mask")[0].style.display = "none";
      document.getElementsByClassName("donate-modal")[0].style.display = "none";
    }

    var gitbook = gitbook || [];
    gitbook.push(function () {
      gitbook.page.hasChanged({"page":{"title":"章节一:flask框架入门","level":"1.4.1","depth":2,"next":{"title":"章节二:模版渲染","level":"1.4.2","depth":2,"path":"flask/chapter2.md","ref":"flask/chapter2.md","articles":[]},"previous":{"title":"Flask Web开发","level":"1.4","depth":1,"ref":"","articles":[{"title":"章节一:flask框架入门","level":"1.4.1","depth":2,"path":"flask/chapter1.md","ref":"flask/chapter1.md","articles":[]},{"title":"章节二:模版渲染","level":"1.4.2","depth":2,"path":"flask/chapter2.md","ref":"flask/chapter2.md","articles":[]},{"title":"章节三:html基本标签","level":"1.4.3","depth":2,"path":"flask/chapter3.md","ref":"flask/chapter3.md","articles":[]},{"title":"章节四:项目拆分","level":"1.4.4","depth":2,"path":"flask/chapter4.md","ref":"flask/chapter4.md","articles":[]},{"title":"章节五:路由参数","level":"1.4.5","depth":2,"path":"flask/chapter5.md","ref":"flask/chapter5.md","articles":[]},{"title":"章节六:请求与响应","level":"1.4.6","depth":2,"path":"flask/chapter6.md","ref":"flask/chapter6.md","articles":[]},{"title":"章节七:flask-Cookie","level":"1.4.7","depth":2,"path":"flask/chapter7.md","ref":"flask/chapter7.md","articles":[]},{"title":"章节八:模型数据","level":"1.4.8","depth":2,"path":"flask/chapter8.md","ref":"flask/chapter8.md","articles":[]},{"title":"章节九:单表-增删查改一","level":"1.4.9","depth":2,"path":"flask/chapter9.md","ref":"flask/chapter9.md","articles":[]},{"title":"章节十:单表-增删查改二","level":"1.4.10","depth":2,"path":"flask/chapter10.md","ref":"flask/chapter10.md","articles":[]},{"title":"章节十一:图书管理系统","level":"1.4.11","depth":2,"path":"flask/chapter11.md","ref":"flask/chapter11.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["-lunr","-sharing","-search","-favicon","code","expandable-chapters","theme-lou","back-to-top-button","search-pro","flexible-alerts","chapter-fold","livereload"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"chapter-fold":{},"livereload":{},"search-pro":{},"code":{"copyButtons":true},"theme-lou":{"hide-elements":[".summary .gitbook-link"],"color":"#2096FF","copyright":{"author":"李航老师"},"forbidCopy":true,"logo":"assets/logo.png","titleColor":{"h1":"#8b008b","h2":"#20b2aa","h3":"#a52a2a"},"search-placeholder":"众里寻他千百度","copyrightLogo":"assets/copyright.png","favicon":"assets/favicon.ico","autoNumber":3},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"back-to-top-button":{},"flexible-alerts":{"style":"callout","note":{"label":"Note","icon":"fa fa-info-circle","className":"info"},"tip":{"label":"Tip","icon":"fa fa-lightbulb-o","className":"tip"},"warning":{"label":"Warning","icon":"fa fa-exclamation-triangle","className":"warning"},"danger":{"label":"Attention","icon":"fa fa-ban","className":"danger"}},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"expandable-chapters":{}},"theme":"default","author":"李航老师","lang":"zh-cn","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{"themeLou":{"nav":[{"target":"_blank","url":"https://space.bilibili.com/378936143","name":"B站"},{"target":"_blank","url":"https://mp.weixin.qq.com/mp/profile_ext?action=home&__biz=MzIzMjY0NjU5Ng==&scene=124#wechat_redirect","name":"公众号"},{"target":"_blank","url":"https://edu.csdn.net/course/detail/32032","name":"CSDN"}]}},"title":"组团学","gitbook":"*","description":"Gitbook电子书示例项目"},"file":{"path":"flask/chapter1.md","mtime":"2023-11-11T04:25:09.789Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2023-12-28T06:53:31.689Z"},"basePath":"..","book":{"language":""}});
    });
  </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-code/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-back-to-top-button/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-flexible-alerts/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-theme-lou/jweixin-1.6.0.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-theme-lou/lou.js"></script>
        
    

    </body>
</html>

